#include <iostream>
#include <queue>
using namespace std;

int main()
{
    queue<int>nums;
    int n,p=0;
    bool isout=false;
    while (1)
    {
        cin>>n;
        if (n>0)
        {
            if (p>=10)
            {
                if (!isout)
                {
                    cout<<"Queue is full!"<<endl;
                    isout=true;
                }
            }
            else
            {
                nums.push(n);
                p++;
            }
        }
        else if (n<0)
        {
            if (nums.empty())
            {
                cout<<"wrong";
                return 0;
            }
            else
            {
                nums.pop();
                p--;
            }
        }
        else
            break;
    }
    cout<<"The Queue is:";
    while (!nums.empty())
    {
        cout<<nums.front()<<" ";
        nums.pop();
    }
    
}